package com.briup.service;

import com.briup.bean.Teacher;
import com.briup.dao.ITeacherDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
// <bean></bean>
// @controller
//spring 扫描 该包的注解  springIOC 创建对象
@Service // 表示spring中创建对象 service对象
public class TeacherServiceImpl implements ITeacherService{
    @Autowired
    private ITeacherDAO dao;
    @Override
    public Teacher findTeacherById(Integer id) throws Exception{
        //System.out.println(1/0);
        if(id == 1){
            throw new Exception("权限不足");
        }
        return dao.findTeacherById(id);
    }

    @Override
    public void addTeacher(Teacher t) {
        throw new RuntimeException("用户添加失败");
    }
}
